<?php
namespace app\index\controller;

use think\Db;

/**
 * 栏目列表
 * User: Administrator
 * Date: 2017/10/28
 * Time: 9:43
 */

class Cata extends Base
{
    public function index(){
        $id = input('cata');
        $cata = Db::name('article')
            ->alias('a')
            ->join('cata c','a.cataid = c.cataid','left')
            ->where('a.cataid',$id)
            ->paginate(10);

//        dump($cata->);die();
        $this->assign('art',$cata);

        return $this->fetch('index/cata/cata');
    }
    public function tags(){
        $tag = input('tag');
        $cata = Db::name('tags')
            ->alias('t')
            ->join('art_tag atg','t.tid = atg.tid','left')
            ->join('article a','a.artid = atg.artid','left')
            ->join('cata c','a.cataid = c.cataid','left')
            ->where('t.tname',$tag)
            ->paginate(10);
//        var_dump($cata);die();
        $this->assign('art',$cata);
        return $this->fetch('index/cata/cata');
    }
}